package com.event.mapper;

import com.event.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface UserMapper {

     @Select("select * from user where username = #{userName}")
     User findByUserName(String userName);

     @Insert("insert into user (username, password, create_time, update_time)" +
             " value (#{userName},#{password},now(),now())")
     void add(String userName,String password);

     @Update("Update user set nickname=#{nickname},email=#{email},update_time=now() where id=#{id}")
     void update(User user);

    @Update("Update user set user_pic=#{avatar},update_time=now() where id=#{id}")
     void updateAvatar(String avatar, Integer id);

    @Update("Update user set password=#{md5String},update_time=now() where id=#{id}")
    void updatePwd(String md5String, Integer id);
}
